#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> pii;

void solve() {
    string s;
    cin >> s;
    int n = s.size();
    int t = 0, p = n;
    for(int i = n - 1; i >= 0; i--) {
        if(s[i] >= '5') {
            if(i == 0) {
                cout << '1';
                for(int j = 0; j < n; j++) {
                    cout << '0';
                }
                cout << '\n';
                return;
            }
            s[i - 1]++;
            p = i;
        }
    }
    for(int i = 0; i < n; i++) {
        if(i >= p) {
            cout << '0';
        }
        else cout << s[i];
    }
    cout << '\n';
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}